Loading TOC...

MarkLogic 10 Product Documentation
GET /v1/config/query/(default|{name})

Summary

Retrieve the query options whose name matches the name in the request URI, or retrieve the default query options.

URL Parameters
format? Specifies the content type of the response, as an alternative to using the Accept header. Accepted values: json and xml (default). This value takes precedence over the Accept headers.
Request Headers
Accept* The expected MIME type of the information in the response. Accepted types: application/json or application/xml. Ignored if the request includes a format parameter value.
Response Headers
Content-Type The MIME type of the data in the response, either application/json or application/xml, depending upon the MIME type requested through the format parameter or Accept header on the request.

Response

Upon success, MarkLogic Server responds with a status 200 (OK) and returns the requested information in the response body, XML or JSON.

If the named configuration does not exist, MarkLogic Server returns a 404 status.

Required Privileges

This operation requires the rest-reader role, or the following privilege:

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

The response body contains a list of search:options nodes, expressed in either XML or JSON, depending upon the format parameter or Accept header setting. For details on the options, see PUT /v1/config/query/(default|{name}).

The returned configuration does not include configuration inherited at runtime from the default or global query options.

The XML or JSON structure returned by this method is suitable for passing to a PUT or POST request to /config/query.

For more details, see Configuring Query Options in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -X GET -i \
  http://localhost:8000/v1/config/query/title

==> The query options previously saved under the name "title".
    For example:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 172
Connection: close

<options xmlns="http://marklogic.com/appservices/search">
  <constraint name="title">
    <word>
      <element ns="" name="TITLE"/>
    </word>
  </constraint>
</options>
  

Example

$ curl --anyauth --user user:password -X GET -i -H "Accept: application/json" \
  'http://localhost:8000/v1/config/query/tuples'

==> The query options previously saved under the name "tuples".
    For example:

Content-type: application/xml
Server: MarkLogic
Content-Length: 211
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 271
Connection: close

{
  "options": {
    "tuples": [
      {
        "name": "speaker-title",
        "range": [
          {
            "type": "xs:string",
            "element": {
              "ns": "",
              "name": "SPEAKER"
            }
          },
          {
            "type": "xs:string",
            "path-index": {
              "text": "/PLAY/ACT/SCENE/TITLE"
            }
          }
        ]
      }
    ],
    "constraint": [
      {
        "name": "title",
        "word": {
          "element": {
            "ns": "",
            "name": "TITLE"
          }
        }
      }
    ]
  }
}
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.